#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

class goods {
public:
    double weight;
    double price;
    double value;

    bool operator<(const goods &G) const {
        return value > G.value;
    }
} buf_data[1000];

int main(int argc, char const *argv[]) {
    double money;
    int n;
    while (scanf("%lf%d", &money, &n) != EOF) {
        if (money == -1 && n == -1)
            break;
        for (int i = 0; i < n; i++) {
            scanf("%lf%lf", &buf_data[i].weight, &buf_data[i].price);
            buf_data[i].value = buf_data[i].weight / buf_data[i].price;
        }
        sort(buf_data, buf_data + n);
        int current_goods_index = 0;
        double final_javabean_weights = 0;
        while (money > 0 && current_goods_index < n) {
            if (money > buf_data[current_goods_index].price) {
                final_javabean_weights += buf_data[current_goods_index].weight;
                money -= buf_data[current_goods_index].price;
            } else {
                final_javabean_weights += buf_data[current_goods_index].value * money;
                money = 0;
            }
            current_goods_index++;
        }
        printf("%.3lf\n", final_javabean_weights);
    }
    return 0;
}